package com.whty.mongodemo.handler;

import com.whty.mongodemo.service.FormDataService;
import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FormDataHandler extends BaseRoutingHandler {

  private final FormDataService service = new FormDataService("form_data");

  public Handler<RoutingContext> insert() {
    return ctx -> {
      JsonObject query = ctx.body().asJsonObject();
      service.insert(query, this.commonReplyHandler(ctx.response()));
    };
  }
}
